package com.liangzhong.model.footballLottery.vo
{
	import com.liangzhong.model.AppData;

	/**
	 *我的竞猜vo 
	 * @author lake
	 * 
	 */	
	public class MyGuessVo
	{
		/**
		 *俱乐部id 
		 */		
		public var clubid 			:int;
		/**
		 *竞猜id 
		 */		
		public var guessid 			:int;
		/**
		 *竞猜类型：
			1.竞猜中 2.竞猜结束 
		 */		
		public var ntype 			:int;
		/**
		 * 下注欧元
		 */		
		public var coin 			:int = 10000;
		/**
		 * 下注点券
		 */		
		public var cashpoint 		:int;
		/**
		 *下注类型:
		1.odds1 2.odds2 3.odds3 
		 */		
		public var oddstype 		:int = 1;
		/**
		 *竞猜奖励：
			0.奖励未派发 1.奖励已派发 
		 */		
		public var status 			:int;
		/**
		 *欧元收入 
		 */		
		public var coinincome 		:int;
		/**
		 *点券收入 
		 */		
		public var cashpointincome :int;
		/**
		 *竞猜开始时间 
		 */		
		public var begintime 		:int;
		/**
		 *竞猜截止时间 
		 */		
		public var endtime 			:int;
		/**
		 * 截止时间 
		 */		
		public var time				:int;
		/**
		 *竞猜内容 
		 */		
		public var guessDetail 		:GuessVo = new GuessVo();
		
		public function MyGuessVo()
		{
		}
		/**
		 *解析数据 
		 * @param data
		 * 
		 */		
		public function parse(data :Object):void
		{
			for (var str:String in data)
			{
				if(this.hasOwnProperty(str))
				{
					this[str] = data[str];
				}
			}
			guessDetail.parse(data.guessinfo);
			guessDetail.status = sstatus;
			time = guessDetail.time;
		}
		/**
		 *获取我的竞猜描述 
		 * @return 
		 * 
		 */
		public function get guessStr():String
		{
			var info :String = "";
			switch(oddstype)
			{
				case 1:
				{
					info = guessDetail.huname + "胜";
					break;
				}
				case 2:
				{
					info = "两队平";
					break;
				}
				case 3:
				{
					info = guessDetail.guname + "胜";
					break;
				}
			}
			return info;
		}
		/**
		 *获取比赛状态 
		 * @return 
		 * 
		 */
		public function get statusStr():String
		{
			var info :String = "";
			switch(sstatus)
			{
				case 1:
				{
					info = "竞猜中";
					break;
				}
				case 2:
				{
					info = "比赛中";
					break;
				}
				default:
				{
					var ret :int = guessDetail.hgoal - guessDetail.ggoal;
					if(ret > 0)
					{
						info = guessDetail.huname + "胜";
					}
					else if(ret < 0)
					{
						info = guessDetail.guname + "胜";
					}
					else
					{
						info = "两队平";
					}
				}
			}
			return info;
		}
		/**
		 *获取押注赔率 
		 * @return 
		 * 
		 */		
		public function get rate():Number
		{
			var rs :Number = 0;
			switch(oddstype)
			{
				case 1:
				{
					rs = guessDetail.odds1;
					break;
				}
				case 2:
				{
					rs = guessDetail.odds2;
					break;
				}
				case 3:
				{
					rs = guessDetail.odds3;
					break;
				}
			}
			return rs;
		}
		/**
		 *获取下注金额 
		 * @return 
		 * 
		 */		
		public function get amt():int
		{
			return coin>0?coin:cashpoint;
		}
		/**
		 * 获取下注金额  详情
		 * @return 
		 * 
		 */		
		public function get amtStr():String
		{
			return coin>0?coin + "欧元":cashpoint + "点券";
		}
		/**
		 *获取奖金描述 
		 * @return 
		 * 
		 */		
		public function get awardStr():String
		{
			var info :String = coin>0?"欧元":"点券";
			var awardCount :int = (coinincome>0?coinincome:cashpointincome);
			return awardCount + info;
		}
		/**
		 *获取竞猜状态  
		 * 1 竞猜中
		 * 2 已截止
		 * 3 已派送
		 * @return 
		 * 
		 */		
		public function get sstatus():int
		{
			if(status == 0)
			{
				if(guessDetail.time > AppData.getInstance().time)
				{
					return 1;
				}
				else
				{
					return 2;
				}
			}
			else
			{
				return 3;
			}
		}
	}
}